//
//  JMMyAnswerViewMode.m
//  VoluntaryStar
//
//  Created by xiaorui on 15/9/10.
//  Copyright (c) 2015年 ios. All rights reserved.
//

#import "JMMyAnswerViewMode.h"
#import "JMAnswerMode.h"

@interface JMMyAnswerViewMode ()

+(NSMutableArray *)dataModel:(NSArray *)array;
@end

@implementation JMMyAnswerViewMode

+ (void) fetchMyAnswerQustionParametes:(NSDictionary *)dict  block:(ReturnBackMessage)block{
    [JMAppNetworkClient circle_AnswerQuestionWithInfo:dict complete:^(id data, NSError *error) {
        NSMutableDictionary *downDict = (NSMutableDictionary *)data;
        if([[downDict objectForKey:@"status"] integerValue] == 1){
            NSArray *array = [JMMyAnswerViewMode dataModel:downDict[@"userlist"]];
            block(data,error,array);
        }else{
            block(data,error,nil);
        }
    }];
}

+(NSMutableArray *)dataModel:(NSArray *)array{
    NSMutableArray *mArray = [[NSMutableArray alloc]initWithCapacity:0];
    for(int i = 0; i <array.count;i++){
        NSDictionary *dict = array[i];
        JMAnswerMode *mode = [[JMAnswerMode alloc]init];
        mode.ask_timeString = dict[@"answer_time"];
        mode.ask_detailString = dict[@"answer_detail"];
        [mArray addObject:mode];
    }
    return mArray;
}


@end
